﻿/********************************************************************
	日期:2022/03/27
	名称:LoadingWnd
	邮箱:yunnibbd@163.com
	作者:yunni
	描述:负责加载界面的逻辑
*********************************************************************/

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class LoadingWnd : WindowRoot{
    public Text txtTips;
    public Image imgFG;
    public Image imgPoint;
    public Text txtPrg;

    private float fgWidth;

    protected override void InitWnd(){
        base.InitWnd();

        fgWidth = imgFG.GetComponent<RectTransform>().sizeDelta.x;
        SetText(txtTips, "这是一条tips");
        SetText(txtPrg, "0%");
        imgFG.fillAmount = 0;
        imgPoint.transform.localPosition = new Vector3(-545f, 0, 0);
    }

    public void SetProgres(float prg){
        SetText(txtPrg, (int) (prg * 100) + "%");
        imgFG.fillAmount = prg;

        float posX = prg * fgWidth - 545f;
        imgPoint.GetComponent<RectTransform>().anchoredPosition = new Vector2(posX, 0);
    }
}